<template>
	<view class="content">
		<view class="top">
			<image class='img' src="../../static/admin_logo.png" mode="widthFix"></image>
			<view class="name">
				{{ detail.staff_name}}
			</view>
		</view>
		
		<view class="form">
			<u-cell-group>
				<!-- <u-cell icon="../../static/me_12.png" title="扫码调试" isLink @click='scan'></u-cell> -->
				<u-cell icon="../../static/me_11.png" title="设备管理" isLink url="/pages/admin/dev"></u-cell>
				<u-cell icon="../../static/user_ma.png" title="用户管理" isLink url='/pages/admin/user'></u-cell>
				<u-cell icon="../../static/me_09.png" title="回收记录" isLink url='/pages/admin/recyclingList'></u-cell>
				<u-cell icon="../../static/me_08.png" title="修改手机号" :value='detail.mobile' isLink url='/pages/admin/changePhone'></u-cell>
				<u-cell icon="../../static/me_07.png" title="修改密码" isLink url='/pages/admin/changePwd'></u-cell>
				<u-cell icon="../../static/me_13.png" title="维修记录" isLink url='/pages/admin/serviceList'></u-cell>
				<u-cell icon="../../static/me_10.png" title="故障报修" isLink url='/pages/admin/errorService'></u-cell>
			</u-cell-group>
		</view>
		<view class="btn">
			<u-button type="primary" text="退出登录" @click='loginout'></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {
					
				}
			}
		},
		onLoad() {
			this.getDetail()
		},
		methods: {
			loginout(){
				uni.removeStorageSync('token')
				uni.reLaunch({
					url: '/pages/admin/login'
				})
			},
			getDetail(){
				var _this = this
				uni.request({
					url: 'http://www.yndzfl.cn/wxsite/Staff/personal',
					method: 'POST',
					header:{
						"Content-Type" : "application/x-www-form-urlencoded"
					},
					data: {
						token: uni.getStorageSync('token'),
						
					},
					success(res) {
						console.log(res)
						if(res.data.code == 1){
							_this.detail = res.data.data
						}else if(res.data.code == -1){
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}else if(res.data.code == 408){
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
							uni.reLaunch({
								url: '/pages/admin/login'
							})
						}
						
					}
				})
			},
			scan(){
				
			}
			
		}
	}
</script>

<style scoped>
.top{
	background: #fff;
	display: flex;
	justify-content: start;
	align-items: center;
	padding: 5px 10px;
}
.img{
	width: 48px;
	height: 48px;
}
.name{
	margin-left: 10px;
}
.form{
	margin-top: 10px;
	background: #fff;
}
.btn{
	margin:20px 10px;
}
</style>
